home *** CD-ROM | disk | FTP | other *** search
- package java.util;
-
- import java.io.Serializable;
- import java.lang.reflect.Array;
-
- class Collections$CheckedMap<K, V> implements Map<K, V>, Serializable {
- private static final long serialVersionUID = 5742860141034234728L;
- // $FF: renamed from: m java.util.Map
- private final Map<K, V> field_0;
- final Class<K> keyType;
- final Class<V> valueType;
- private K[] zeroLengthKeyArray = null;
- private V[] zeroLengthValueArray = null;
- private transient Set<Map.Entry<K, V>> entrySet = null;
-
- private void typeCheck(Object var1, Object var2) {
- if (!this.keyType.isInstance(var1)) {
- throw new ClassCastException("Attempt to insert " + var1.getClass() + " key into collection with key type " + this.keyType);
- } else if (!this.valueType.isInstance(var2)) {
- throw new ClassCastException("Attempt to insert " + var2.getClass() + " value into collection with value type " + this.valueType);
- }
- }
-
- Collections$CheckedMap(Map<K, V> var1, Class<K> var2, Class<V> var3) {
- if (var1 != null && var2 != null && var3 != null) {
- this.field_0 = var1;
- this.keyType = var2;
- this.valueType = var3;
- } else {
- throw new NullPointerException();
- }
- }
-
- public int size() {
- return this.field_0.size();
- }
-
- public boolean isEmpty() {
- return this.field_0.isEmpty();
- }
-
- public boolean containsKey(Object var1) {
- return this.field_0.containsKey(var1);
- }
-
- public boolean containsValue(Object var1) {
- return this.field_0.containsValue(var1);
- }
-
- public V get(Object var1) {
- return (V)this.field_0.get(var1);
- }
-
- public V remove(Object var1) {
- return (V)this.field_0.remove(var1);
- }
-
- public void clear() {
- this.field_0.clear();
- }
-
- public Set<K> keySet() {
- return this.field_0.keySet();
- }
-
- public Collection<V> values() {
- return this.field_0.values();
- }
-
- public boolean equals(Object var1) {
- return var1 == this || this.field_0.equals(var1);
- }
-
- public int hashCode() {
- return this.field_0.hashCode();
- }
-
- public String toString() {
- return this.field_0.toString();
- }
-
- public V put(K var1, V var2) {
- this.typeCheck(var1, var2);
- return (V)this.field_0.put(var1, var2);
- }
-
- public void putAll(Map<? extends K, ? extends V> var1) {
- Object var2 = null;
-
- try {
- var2 = var1.keySet().toArray(this.zeroLengthKeyArray());
- } catch (ArrayStoreException var6) {
- throw new ClassCastException();
- }
-
- Object var3 = null;
-
- try {
- var3 = var1.values().toArray(this.zeroLengthValueArray());
- } catch (ArrayStoreException var5) {
- throw new ClassCastException();
- }
-
- if (((Object[])var2).length != ((Object[])var3).length) {
- throw new ConcurrentModificationException();
- } else {
- for(int var4 = 0; var4 < ((Object[])var2).length; ++var4) {
- this.field_0.put(((Object[])var2)[var4], ((Object[])var3)[var4]);
- }
-
- }
- }
-
- private K[] zeroLengthKeyArray() {
- if (this.zeroLengthKeyArray == null) {
- this.zeroLengthKeyArray = (K[])((Object[])Array.newInstance(this.keyType, 0));
- }
-
- return this.zeroLengthKeyArray;
- }
-
- private V[] zeroLengthValueArray() {
- if (this.zeroLengthValueArray == null) {
- this.zeroLengthValueArray = (V[])((Object[])Array.newInstance(this.valueType, 0));
- }
-
- return this.zeroLengthValueArray;
- }
-
- public Set<Map.Entry<K, V>> entrySet() {
- if (this.entrySet == null) {
- this.entrySet = new Collections.CheckedMap.CheckedEntrySet(this.field_0.entrySet(), this.valueType);
- }
-
- return this.entrySet;
- }
- }
-